﻿@{ Webcar.Controllers.ShowInsureOptions options = (Webcar.Controllers.ShowInsureOptions)ViewBag.ShowOptions; }
@{ Layout = "~/Views/Shared/_leftPanelLayout.cshtml";}
@section LeftTree
{
     
    @{
        Html.RenderPartial("DeptTreePartialView", new Webcar.Models.DeptTreeMode { Action = "List", Controller = "Insure", ShowChild = true });
     }
}

@using (Ajax.BeginForm("ListPartialView", "Insure",Html.ViewContext.RouteData.Values, new AjaxOptions
    {
        HttpMethod = "POST",
        UpdateTargetId = "list-car",
        //OnBegin = "function{ showLoading();}",
        //OnComplete = "function(){ alert('sdsdsd'); }",
        InsertionMode = System.Web.Mvc.Ajax.InsertionMode.Replace
    }))
    { 
        @UserQuery.CreateQuery(setting => {
       setting.QueryKey = QuerySettings.InsureList;
           setting.Columns.Add(new QueryColumn() { Field = "RECORD_NO", Name = "牌照号" });
           setting.Columns.Add(new QueryColumn() { Field = "INSURE_NO2", Name = "保险单号" });
           setting.Columns.Add(new QueryColumn() { Field = "CAR_CLASS_NAME", Name = "详细车型" });
           setting.Columns.Add(new QueryColumn() { Field = "START_DATE", Name = "开始日期", DataType = TypeofQueryColumn.Date });
           setting.Columns.Add(new QueryColumn() { Field = "END_DATE", Name = "保险到期日期", DataType = TypeofQueryColumn.Date });
           setting.Columns.Add(new QueryColumn() { Field = "END_MONTH", Name = "保险到期月份", DataType = TypeofQueryColumn.Text });
       
           setting.Columns.Add(new QueryColumn() { Field = "INSURE_MONEY", Name = "保单金额", DataType = TypeofQueryColumn.Number });
           setting.Columns.Add(new QueryColumn() { Field = "INSURE_DAY", Name = "到期天数", DataType = TypeofQueryColumn.Number });
       
           setting.Columns.Add(new QueryColumn() { Field = "STATUS", Name = "保单状态"});
        })
}

@using (Html.BeginForm()) {
    <div style="margin-bottom:1px;">
        @Html.CheckBox("ShowLast", options.ShowLast)
        <label for="ShowLast">只显示单车最后一条保险</label>
        &nbsp;
        &nbsp;
        @Html.SubmitButton("btnApply", "应用")
    </div>
}
<hr />
<div id="list-car">
    @Html.Action("ListPartialView")
</div>
<hr />
<table>
    <tr>
        <td>
             @Html.DevExpress().Button(settings =>
{
    settings.Name = "Button1";
    settings.Text = "增加保险单";
    settings.Width = 100;
    settings.ControlStyle.CssClass = "button1";
    settings.ClientSideEvents.Click = "function(s, e){ location.href='" + @Url.Action("Edit", "Insure", new { is_continue=false}) + "' }";
}).GetHtml()
        </td>
<td>
     @Html.DevExpress().Button(settings =>
{
    settings.Name = "Button2";
    settings.Text = "导出Excel";
    settings.Width = 100;
    settings.ControlStyle.CssClass = "button1";
    settings.ClientSideEvents.Click = "function(s, e){ location.href='" + @Url.Action("Export", "Insure", Html.ViewContext.RouteData.Values) + "' }";
}).GetHtml()
</td>

    </tr>
</table>
